import plotly
import pandas as pd
import plotly.graph_objects as go
data = pd.read_csv('data/nz_weather.csv')
print(data.head())
line1 = go.Scatter(x=data['DATE'], y=data['Auckland'], name='Auckland')
line2 = go.Scatter(x=data['DATE'], y=data['Wellington'], name='Wellington')
fig  = go.Figure([line1, line2])
fig.update_layout(
    title = "New Zealand Weather",
    xaxis_title = "Date",
    yaxis_title = "Weather"
)
# fig.show()

# Bar Chart
data_2010 = data[(data['DATE'] >= '2010-01') & (data['DATE'] < '2011-01')]

bar1 = go.Bar(x = data_2010['DATE'], y = data_2010['Auckland'],
              text = data_2010['Auckland'], textposition='outside')
fig = go.Figure(bar1)
# fig.show()
bar1 = go.Bar(x = data_2010['DATE'], y = data_2010['Auckland'],
              text = data_2010['Auckland'], textposition='outside', name='Auckland')
bar2 = go.Bar(x = data_2010['DATE'], y = data_2010['Wellington'],
              text = data_2010['Wellington'], textposition='outside', name='Wellington')
fig = go.Figure([bar1, bar2])
# fig.show()

# Histogram
hist = go.Histogram(x = data['Auckland'])
fig = go.Figure(hist)
fig.update_layout(bargap=0.1)
fig.show()
hist = go.Histogram(x = data['Auckland'], xbins={'size': 5})
fig = go.Figure(hist)
fig.update_layout(bargap=0.1)
fig.show()
